import {ConfigConstant, ConfigKey} from "../../../constant/ConfigConstant";
import {ProductConfig} from "../../../../../config/ProductConfig";
import {FinalConstant, FinalKey} from "../../../constant/FinalConstant";
import {ProductFinal} from "../../../../../config/ProductFinal";
import {ProductUI} from "../../../../../config/ProductUI";
import {ProductResource} from "../../../../../config/ProductResource";
import {ResourceConstant, ResourceKey} from "../../../constant/ResourceConstant";
import {UIConfigKey, UIConfig} from "../../../constant/UIConfig";

/** @noSelf **/

export default class Configer {
    static getConfig(numKey: ConfigKey) {
        const newProductValue = Configer.getProductConfig(numKey, ConfigConstant, ProductConfig);
        return newProductValue;
    }
    static getFinal(numKey: FinalKey) {
        const newProductValue = Configer.getProductConfig(numKey, FinalConstant, ProductFinal);
        return newProductValue;
    }
    static getUIConfig(numKey: UIConfigKey) {
        const newProductValue = Configer.getProductConfig(numKey, UIConfig, ProductUI);
        return newProductValue;
    }
    static getResource(numKey: ResourceKey) {
        const newProductValue = Configer.getProductConfig(numKey, ResourceConstant, ProductResource);
        return newProductValue;
    }

    static getProductConfig(numKey: number, devConfig: any, proConfig?: any) {
        const key = numKey;
        let productValue = devConfig[key]
        if (proConfig && proConfig[key]) {
            productValue = proConfig[key];
        }
        // const newProductValue = JSON.parse(JSON.stringify(productValue));
        return productValue;
    }
}

